pro check_selection

; read in selected ParticleIDs
sel_ids  = h5rd('test.hdf5','ParticleIDs')
sel_type = h5rd('test.hdf5','Type')

; decomposose into types
sel_gas  = sel_ids[where(sel_type eq 0)]
sel_cdm  = sel_ids[where(sel_type eq 1)]
sel_star = sel_ids[where(sel_type eq 4)]

; read snapshot
gas_ids  = snap(33,0,'ParticleIDs',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')
cdm_ids  = snap(33,1,'ParticleIDs',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')
star_ids = snap(33,4,'ParticleIDs',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')
gas_pos  = snap(33,0,'Coordinates',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')
cdm_pos  = snap(33,1,'Coordinates',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')
star_pos = snap(33,4,'Coordinates',indir='/nfs/cluster/cosmicx6/rcrain/OWLS/THERMAL/L100N512/Data/Snapshots')

; find indices within snapshot of selected gas particles
listmatch,sel_gas ,gas_ids ,ind_gas_sel ,ind_gas_snap
listmatch,sel_cdm ,cdm_ids ,ind_cdm_sel ,ind_cdm_snap
listmatch,sel_star,star_ids,ind_star_sel,ind_star_snap

; plot up
set_plot,'x'
window,0,xs=512,ys=512
plot,gas_pos[0,ind_gas_snap]  ,gas_pos[1,ind_gas_snap]  ,psym=3,/iso,/ynozero
window,1,xs=512,ys=512
plot,cdm_pos[0,ind_cdm_snap]  ,cdm_pos[1,ind_cdm_snap]  ,psym=3,/iso,/ynozero
window,2,xs=512,ys=512
plot,star_pos[0,ind_star_snap],star_pos[1,ind_star_snap],psym=3,/iso,/ynozero

end
